package task;

import java.awt.*;
import java.util.ArrayList;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        List<Equipment> equipments = new ArrayList<Equipment>();
        Equipment e1 = new Equipment("设备A", new Point(117, 30));
        Equipment e2 = new Equipment("设备B", new Point(118, 31));
        Equipment e3 = new Equipment("设备C", new Point(115, 28));
        Equipment e4 = new Equipment("设备D", new Point(116, 31));
        Equipment e5 = new Equipment("设备E", new Point(115, 26));
        Equipment e6 = new Equipment("设备F", new Point(116, 30));
        Equipment e7 = new Equipment("设备G", new Point(118, 32));
        Equipment e8 = new Equipment("设备H", new Point(118, 26));
        Equipment e9 = new Equipment("设备I", new Point(116, 27));
//        Equipment e10 = new Equipment("设备I", new Point(119, 31));

        equipments.add(e1);
        equipments.add(e2);
        equipments.add(e3);
        equipments.add(e4);
        equipments.add(e5);
        equipments.add(e6);
        equipments.add(e7);
        equipments.add(e8);
        equipments.add(e9);
//        equipments.add(e10);
        //      System.out.println(equipments.size());
        Util util = new Util();
        List<Equipment> result = util.getEquipment(equipments);
        for (int i = 0; i < result.size(); i++) {
            System.out.println(result.get(i).name + ":[" + result.get(i).point.x + "," + result.get(i).point.y + "]");
        }
        //寻找最近的设备
        Worker worker1 = new Worker("张三", new Point(119, 30));
        Worker worker2 = new Worker("李四", new Point(116, 30));
        Util.findMinDis(worker1, equipments);
        Util.findMinDis(worker2, equipments);
    }

}
